import {openNotice} from './../../../utils'

import * as Select from '../../../services/userManager/userProject/select.js';
export default {
  namespace: '$selecItem',
  state: {
    visible: false,
    pamrms: {},  // list页面带过来参数
    selectList: [],
    selectTotal:0,
    selectItems:[],
    pageParam: { // 分页+名称筛选的参数
      pageNo: 1,
      pageSize: 10,
      keyword: '',
      key: 'value',
      value: 'desc'
    },
    loading: false, // 列表的展示蒙层的标识
    FilterParam:{}
  },
  reducers: {
    save(state, {payload}) {
      return {...state, ...payload};
    }
  },
  effects: {
    *fetch({payload}, {call, put, select}) {
      yield put({type: 'save', payload: {...payload}});
      yield put({type: 'save',payload: {loading:true,visible:true}});
      var pageParam = yield select(function (state) {return state.selecItem});
      const srcData = yield call(Select.fetch,pageParam);
      yield put({
        type: 'save',
        payload: {selectList: srcData.data, selectTotal: parseInt(srcData.iTotalDisplayRecords, 10)},
      });
      yield put({type: 'save',payload: {loading:false}});
    }
  },
  subscriptions: {}
};
